<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
.box {
  width: 600px;
  height: 200px;
  margin: 100px auto;
  border: 1px solid gray;
}
h3 {
  text-align: center;
  font-weight: 700;
}
p {
  margin-left: 20px;
}
.one {
  width: 80px;
  margin-top: 20px;
  margin-left: 200px;
}
.two {
  margin-left: 40px;
  width: 80px;
}
span {
  color:red;
}
</style>
<body>
  <div class="box">
    <h3>抽取姓名</h4>
      <p>抽到的人是：<span>姓名</span></p>
      <button class="one">开始</button><button class="two">结束</button>
  </div>
  <script>
     const people = ['大爱仙尊方源', '戏神陈伶', '林七夜', '天帝叶凡', '浔阳帝江烟浔', '愚者克莱恩', '鬼眼杨间', '仙武帝尊叶辰','万古神帝张若尘','荒天帝石昊']
     const one=document.querySelector('.one')
     const two=document.querySelector('.two')
     const span=document.querySelector('span')
     let i=0
     let n;
     one.addEventListener('click',function(){
      n=setInterval(function(){
      i++
      if(i>=people.length){
        i=0;
      }
span.innerHTML=people[i]
     },50)
     })

     two.addEventListener('click',function(){
      clearInterval(n)
 const lastName=span.innerHTML
 const index = people.indexOf(lastName);
    if (index !== -1) {
      people.splice(index, 1);
    }
    if(people.length===1){
      one.disabled=true
    }
     })
  </script>
</body>
</html>